/**
 * 
 */
package product1.action;

import product1.entity.User;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Ashwani Godara
 *
 */
@SuppressWarnings("serial")
public class LoginAction extends ActionSupport {
	
	private User user;
	public User getUser(){
		return this.user;
	}
	public void setUser(User user){
		this.user=user;
	}
	
	public String login(){
		return validateUser();
		
	}
	
	private String validateUser(){
		
		if(user.getName().equalsIgnoreCase("ashwani")){
			return SUCCESS;
		}else{
			addFieldError("user.name", "Please try again");
			return INPUT;
		}
	}

}
